package com.cxs.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Project: spring-boot-thymeleaf-demo
 * @Author: cxs2014501@163.com
 * @Create: 2023/2/15 13:58
 * @Description:
 **/
@Controller
public class ViewController {

    @GetMapping("/index")
    public ModelAndView index(ModelAndView modelAndView){
        modelAndView.setViewName("index");
        return modelAndView;
    }

    @GetMapping("/demo")
    public ModelAndView demo(ModelAndView modelAndView){
        modelAndView.setViewName("demo");
        modelAndView.addObject("msg", "Hello, Thymeleaf!");
        modelAndView.addObject("link", "https://www.baidu.com");
        return modelAndView;
    }
}
